﻿#region Using
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using MySql.Data.MySqlClient;
using System.Configuration;
using System.Data;
#endregion

#region Copyright Analyseinvestor 2013
//
// All rights are reserved. Reproduction or transmission in whole or in part, in 
// any form or by any means, electronic, mechanical or otherwise, is prohibited 
// without the prior written consent of the copyright owner.
// 
// Filename: DatabaseManager.cs
//
#endregion

/// <summary>
/// Summary description for DatabaseManager
/// </summary>
/// 

public class DatabaseManager
{
  string connectionString = "Server=mysql10.unoeuro.com;Database=analyseinvestor_dk_db;Uid=analyseinves_dk;Pwd=flydaisy;";
  MySqlConnection sqlConnection;
  MySqlCommand cmd;
  MySqlDataReader reader;

  public DatabaseManager()
  {
    sqlConnection = new MySqlConnection(connectionString);
    cmd = new MySqlCommand();
  }

  public MySqlDataReader ExecuteStoredProcedure(string storedProcedure)
  {
    sqlConnection.Open();
    cmd.Connection = sqlConnection;
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.CommandText = storedProcedure;
    return cmd.ExecuteReader(CommandBehavior.CloseConnection);
  }

  public void AddParameter(string parameterName, object value)
  {
    cmd.Parameters.AddWithValue(parameterName, value);
  }
}